com.willowtreeapps.android.shared.lv
Class AmazingAdapter

java.lang.Object
  extended by android.widget.BaseAdapter
      extended by com.willowtreeapps.android.shared.lv.AmazingAdapter
All Implemented Interfaces:
android.widget.AbsListView.OnScrollListener, android.widget.Adapter, android.widget.ListAdapter, android.widget.SectionIndexer, android.widget.SpinnerAdapter
Direct Known Subclasses:
FilterAdapter

public abstract class AmazingAdapter
extends android.widget.BaseAdapter
implements android.widget.SectionIndexer, android.widget.AbsListView.OnScrollListener


Field Summary
static int PINNED_HEADER_GONE
          Pinned header state: don't show the header.
static int PINNED_HEADER_PUSHED_UP
          Pinned header state: show the header.
static int PINNED_HEADER_VISIBLE
          Pinned header state: show the header at the top of the list.
static String TAG
           
 
Fields inherited from interface android.widget.AbsListView.OnScrollListener
SCROLL_STATE_FLING, SCROLL_STATE_IDLE, SCROLL_STATE_TOUCH_SCROLL
 
Fields inherited from interface android.widget.Adapter
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
 
Constructor Summary
AmazingAdapter()
           
 
Method Summary
protected abstract  void bindSectionHeader(android.view.View view, int position, boolean displaySectionHeader)
          Configure the view (a listview item) to display headers or not based on displaySectionHeader (e.g.
abstract  void configurePinnedHeader(android.view.View header, int position, int alpha)
          Configures the pinned header view to match the first visible list item.
abstract  android.view.View getAmazingView(int position, android.view.View convertView, android.view.ViewGroup parent)
          read: get view too
 int getPinnedHeaderState(int position)
          Computes the desired state of the pinned header for the given position of the first visible list item.
abstract  int getPositionForSection(int section)
           
abstract  int getSectionForPosition(int position)
           
abstract  Object[] getSections()
           
 android.view.View getView(int position, android.view.View convertView, android.view.ViewGroup parent)
           
 void onScroll(android.widget.AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
           
 void onScrollStateChanged(android.widget.AbsListView view, int scrollState)
           
 
Methods inherited from class android.widget.BaseAdapter
areAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.widget.Adapter
getCount, getItem, getItemId
 

Field Detail

TAG

public static final String TAG

PINNED_HEADER_GONE

public static final int PINNED_HEADER_GONE
Pinned header state: don't show the header.

See Also:
Constant Field Values

PINNED_HEADER_VISIBLE

public static final int PINNED_HEADER_VISIBLE
Pinned header state: show the header at the top of the list.

See Also:
Constant Field Values

PINNED_HEADER_PUSHED_UP

public static final int PINNED_HEADER_PUSHED_UP
Pinned header state: show the header. If the header extends beyond the bottom of the first shown element, push it up and clip.

See Also:
Constant Field Values
Constructor Detail

AmazingAdapter

public AmazingAdapter()
Method Detail

getPinnedHeaderState

public int getPinnedHeaderState(int position)
Computes the desired state of the pinned header for the given position of the first visible list item. Allowed return values are PINNED_HEADER_GONE, PINNED_HEADER_VISIBLE or PINNED_HEADER_PUSHED_UP.


onScroll

public void onScroll(android.widget.AbsListView view,
                     int firstVisibleItem,
                     int visibleItemCount,
                     int totalItemCount)
Specified by:
onScroll in interface android.widget.AbsListView.OnScrollListener

onScrollStateChanged

public void onScrollStateChanged(android.widget.AbsListView view,
                                 int scrollState)
Specified by:
onScrollStateChanged in interface android.widget.AbsListView.OnScrollListener

getView

public final android.view.View getView(int position,
                                       android.view.View convertView,
                                       android.view.ViewGroup parent)
Specified by:
getView in interface android.widget.Adapter

bindSectionHeader

protected abstract void bindSectionHeader(android.view.View view,
                                          int position,
                                          boolean displaySectionHeader)
Configure the view (a listview item) to display headers or not based on displaySectionHeader (e.g. if displaySectionHeader header.setVisibility(VISIBLE) else header.setVisibility(GONE)).


getAmazingView

public abstract android.view.View getAmazingView(int position,
                                                 android.view.View convertView,
                                                 android.view.ViewGroup parent)
read: get view too


configurePinnedHeader

public abstract void configurePinnedHeader(android.view.View header,
                                           int position,
                                           int alpha)
Configures the pinned header view to match the first visible list item.

Parameters:
header - pinned header view.
position - position of the first visible list item.
alpha - fading of the header view, between 0 and 255.

getPositionForSection

public abstract int getPositionForSection(int section)
Specified by:
getPositionForSection in interface android.widget.SectionIndexer

getSectionForPosition

public abstract int getSectionForPosition(int position)
Specified by:
getSectionForPosition in interface android.widget.SectionIndexer

getSections

public abstract Object[] getSections()
Specified by:
getSections in interface android.widget.SectionIndexer


Copyright © 2011. All Rights Reserved.